/* ========== SOLUTION CORRIGÉE ========== */

/* ============================================= */
/* RÉINITIALISATION ET STYLES DE BASE */
/* ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f8fafc;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 16px;
}

/* ============================================= */
/* CONTAINER PRINCIPAL - CENTRAGE */
/* ============================================= */

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================= */
/* VERSION DESKTOP DES ANNONCES */
/* ============================================= */

.annonce-desktop {
    display: flex;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    height: 240px; /* Hauteur fixe pour uniformité */
}

/* Conteneur d'image pour desktop */
.image-container {
    flex: 0 0 35%; /* Largeur fixe de 35% */
    position: relative;
    overflow: hidden;
}

/* Image desktop */
.image-desktop {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Maintient les proportions */
    display: block;
}

/* ============================================= */
/* 1. SÉCURITÉ DESKTOP : On cache la carte mobile sur PC */
/* ============================================= */
@media (min-width: 768px) {
    .annonce-mobile {
        display: none !important;
    }
}

/* ============================================= */
/* 2. VERSION MOBILE : Styles appliqués UNIQUEMENT sur Mobile */
/* ============================================= */
@media (max-width: 767px) {
    .annonce-mobile {
        /* FORCE L'AFFICHAGE ET LE STYLE */
        display: block !important;
        background: rgb(255, 255, 255) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
        border: 1px solid #e73103 !important;

        /* === 1. LARGEUR (Reste large) === */
        width: 108% !important; 
        max-width: none !important;
        margin-left: -10px !important;
        margin-right: auto !important;

        /* === 2. HAUTEUR (LA CORRECTION EST ICI) === */
        height: auto !important; /* Hauteur automatique */
        
        /* 🛑 C'EST CETTE LIGNE QUI BLOQUAIT LA RÉDUCTION */
        /* On passe de 400px à 'auto' */
        min-height: auto !important; 
        
        overflow: hidden !important;

        /* === 3. ESPACE EN BAS (Maintenant ça va marcher) === */
        margin-bottom: 15px !important; /* Espace entre les cartes */
        padding-bottom: 10px !important; /* Petit espace interne juste pour pas coller au bord */
        
        transform: translateY(-100px);
        position: relative !important;
        z-index: 1 !important;
    }
}
/* Conteneur d'image pour mobile */
.image-mobile-container {
    position: relative;
    overflow: hidden;
}

/* Image mobile - plus grande que sur desktop */
.image-mobile {
    width: 100%;
    height: 220px; /* Hauteur fixe plus grande sur mobile */
    object-fit: cover;
    display: block;
}

/* ============================================= */
/* BADGE EXCLUSIVITÉ */
/* ============================================= */

.annonce-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #2734f1, #2734f1); /* Dégradé vert */
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    z-index: 2; /* Au-dessus de l'image */
}

/* ============================================= */
/* BOUTON FAVORI */
/* ============================================= */

.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.95); /* Blanc semi-transparent */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.favorite-btn:hover {
    background: rgba(255,255,255,1);
    transform: scale(1.05);
}

/* ============================================= */
/* STYLES DE BASE (Desktop First) */
/* ============================================= */

.content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Styles de base pour le TITRE - Desktop */
.annonce-titre {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    margin-bottom: 8px;
}

/* Styles de base pour le PRIX - Desktop */
.annonce-prix {
    font-size: 24px;
    font-weight: 700;
    color: #2734f1;
    text-align: right;
    margin-top: -80px;  /* ← AJOUTE CETTE LIGNE POUR FAIRE MONTER LE PRIX */
}
.annonce-localisation {
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 55px;
      transform: translateY(12px);  /* ← UTILISE TRANSFORM À LA PLACE */
}

.location-icon {
    color: #4a27e4;
    margin-right: 6px;
    font-size: 16px;
}

.annonce-description {
    font-size: 14px;
    color: #000000;
    line-height: 1.5;
    margin-bottom: 0;      /* ← REMET À ZÉRO */
    flex: 1;
    transform: translateY(-852px);  /* ← UTILISE TRANSFORM À LA PLACE */
}


/* ============================================= */
/* VERSION DESKTOP SEULEMENT */
/* ============================================= */

@media (min-width: 768px) {
    /* RÈGLES TITRE UNIQUEMENT POUR DESKTOP */
    .annonce-titre {
        position: relative;
        top: 5px;
        left: 0px;
        font-size: 20px;
    }
    
    /* RÈGLES PRIX UNIQUEMENT POUR DESKTOP */
    .annonce-prix {
        position: relative;
        top: 10px;
        right: 0px;
        font-size: 24px;
        text-align: right;
    }
}

/* ============================================= */
/* VERSION MOBILE SEULEMENT */
/* ============================================= */

@media (max-width: 767px) {
    /* RÈGLES TITRE UNIQUEMENT POUR MOBILE */
    .annonce-titre {
        position: relative;
        top: 1px;      /* HAUT/BAS */
        left: 0px;       /* GAUCHE/DROITE */
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    /* RÈGLES PRIX UNIQUEMENT POUR MOBILE */
    .annonce-prix {
        position: absolute !important;
        top: 255px !important;    /* HAUT/BAS */
        right: 20px !important;   /* GAUCHE/DROITE */
        font-size: 20px;
        text-align: right;
        margin-bottom: 0;
        z-index: 10;
    }
    
    /* RÈGLES LOCALISATION MOBILE */
    .annonce-localisation {
        position: relative;
        top: 20px;       /* HAUT/BAS */
        left: 0px;       /* GAUCHE/DROITE */
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    /* RÈGLES DESCRIPTION MOBILE */
    .annonce-description {
        position: relative;
        top: -600px;        /* HAUT/BAS */
        left: 0px;       /* GAUCHE/DROITE */
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .caracteristiques {
        display: none;
    }
    
    .bouton-mobile {
        position: relative;
        top: 10px;       /* HAUT/BAS */
        min-width: 120px;
        padding: 10px 16px;
    }
    
    .annonce-mobile {
        margin-top: 60px;
        min-height: 220px;
    }
}

/* ============================================= */
/* BOUTONS PRINCIPAUX */
/* ============================================= */
.bouton-desktop {
    background: linear-gradient(135deg, #2734f1, #2734f1); /* Dégradé vert */
    color: white;
    border: 1px solid #059669;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-width: 180px;
    transition: all 0.3s ease;

    /* ✅ Placement dans le flux normal */
    display: inline-block;
    margin-top: -5px; /* Ajuste la distance du haut */
    align-self: flex-end; /* Fonctionne si le parent est en display:flex */

    /* ✅ Supprime toute position absolue pour éviter qu'il "disparaisse" */
    position: static;
}

.bouton-desktop:hover {
    background: linear-gradient(135deg, #2734f1, #2734f1);
    transform: translateY(-1px);
}

/* Bouton mobile - positionné à droite */
.bouton-mobile {
    background: linear-gradient(135deg, #2734f1, #2734f1);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    align-self: flex-end; /* Alignement à droite sur mobile */
    min-width: 160px;
    border: 1px solid #0e41ce;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.bouton-mobile:hover {
    background: linear-gradient(135deg, #2734f1, #2734f1);
    transform: translateY(-1px);
}

/* ============================================= */
/* CARACTÉRISTIQUES (POUR LES DONNÉES STRAPI) */
/* ============================================= */

.caracteristiques {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ============================================= */
/* RÈGLES RESPONSIVE */
/* ============================================= */

/* Desktop : afficher seulement la version desktop */
@media (min-width: 768px) {
    .annonce-mobile { 
        display: none; 
    }
}

/* Mobile : afficher seulement la version mobile */
@media (max-width: 767px) {
    .annonce-desktop { 
        display: none; 
    }
    
    .content { 
        padding: 16px; /* Padding réduit sur mobile */
    }
    
    .annonce-titre { 
        font-size: 18px; /* Taille de police réduite */
    }
    
    .annonce-prix { 
        font-size: 22px; /* Taille de prix réduite */
        text-align: left; /* Alignement à gauche sur mobile */
        margin-bottom: 12px;
    }
    
    .bouton-mobile { 
        align-self: flex-end; /* Maintien à droite */
        min-width: 140px; /* Largeur réduite */
    }
    
    .caracteristiques {
        font-size: 11px; /* Taille réduite sur mobile */
    }
}

/* ============================================= */
/* RÈGLES COMPLÈTES POUR LES TAILLES ET POSITIONS */
/* ============================================= */

/* === VERSION DESKTOP - CENTRÉE === */
.annonce-desktop {
    /* Conteneur principal desktop */
    height: 250px;                    /* Hauteur totale */
    width: 880px;                     /* Largeur totale */
    margin-top: 60px;                 /* Position depuis le haut */
    margin-bottom: -30px;              /* Espace en bas */
    margin-left: auto;                /* Centrage automatique gauche */
    margin-right: auto;               /* Centrage automatique droite */
}

.image-container {
    /* Conteneur image desktop */
    height: 250px;                    /* Hauteur image */
    width: 300px;                     /* Largeur image fixe */
    flex-shrink: 0;                   /* Empêche le rétrécissement */
}

.image-desktop {
    /* Image elle-même desktop */
    height: 100%;                     /* Prend toute la hauteur */
    width: 100%;                      /* Prend toute la largeur */
    object-fit: cover;                /* Cadrage de l'image */
}

.content {
    /* Contenu texte desktop */
    flex: 1;                          /* Prend l'espace restant */
    padding: 20px;                    /* Espacement interne */
}

/* === VERSION MOBILE === */
.annonce-mobile {
    /* Conteneur principal mobile */
    min-height: 240px;
    max-height: none;
    margin-top: 40px !important;  /* FORCEZ avec !important */
    margin-bottom: 20px;
    margin-left: 5px;
    margin-right: 10px;
    width: 98%;    
    border: 2px solid #e2e8f0;
    position: relative;            /* AJOUTEZ cette ligne */
    top: 90px;                      /* AJOUTEZ cette ligne pour contrôle */
}

.image-mobile-container {
    /* Conteneur image mobile */
    height: 160px;                    /* Hauteur image réduite */
    width: 100%;                      /* Largeur image */
}

.image-mobile {
    /* Image elle-même mobile */
    height: 100%;                     /* Prend toute la hauteur */
    width: 100%;                      /* Prend toute la largeur */
    object-fit: cover;                /* Cadrage de l'image */
}

/* ============================================= */
/* NOUVELLE STRUCTURE PRIX + DESCRIPTION MOBILE */
/* ============================================= */

@media (max-width: 767px) {
    /* Ligne prix + description côte à côte */
    .annonce-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 8px;
    }
    
    .annonce-titre {
        font-size: 16px;
        margin-bottom: 0;
        flex: 1;
    }
    
    .annonce-prix {
        font-size: 18px;
        text-align: right;
        margin-left: 10px;
        margin-bottom: 0;
        white-space: nowrap;
        flex-shrink: 0;
        position: relative;
        top: -2px; /* DÉPLACE LE PRIX VERS LE HAUT */
    }
    
    .annonce-localisation {
        font-size: 13px;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .annonce-description {
        font-size: 12px;
        margin-bottom: 8px;
        line-height: 1.4;
        position: relative;
        top: 1500px; /* DÉPLACE LA DESCRIPTION VERS LE HAUT */
    }
    
    .caracteristiques {
        display: none; /* SUPPRIME les caractéristiques sur mobile */
    }
    
    .bouton-mobile {
        margin-top: 4px;
        min-width: 120px;
        padding: 10px 16px;
    }
    
    /* FILTRE FIN AUTOUR DE LA CARTE MOBILE */
    .annonce-mobile {
        border: 2px solid #f1f5f9;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
}

/* ============================================= */
/* BORDURES FINES FORCÉES */
/* ============================================= */

.annonce-desktop,
.annonce-mobile {
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

